/**
 * 用户评价
 */

import React from 'react'
import { IGood } from '@/model/declare';
import { View } from '@tarojs/components';
// import { ImageProps } from '@/components/Image';


import './index.scss'
import { ImageEle } from '@/components/Image';
import { Rate } from '@/components/Rate';
import { PreviewEle } from './Preview';
// import goods from '@/pages/home/goods';

export interface IUserRateProps {
    title: string
    avater: string
    rate: number
    time: string
    content: string
    goods?: IGood[]
}


export const UserRateEle: React.FC<IUserRateProps> = (props) => {

    return (
        <View className="xxm-user-rate-ls">
            <View className="xxm-user-rate-ls__avater">
                <ImageEle width={48} height={48} src={props.avater} round showError showLoading />
            </View>
            <View className="xxm-user-rate-ls__outer">
                <View className="xxm-user-rate-ls__inner">
                    <View className="xxm-user-rate-ls__title">
                        {props.title}
                    </View>
                    <View className="xxm-user-rate-ls__rate">
                        <View className="xxm-user-rate-ls__rate-ls">
                            <Rate readonly value={props.rate || 1} size={16} />
                        </View>
                        <View className="xxm-user-rate-ls__time">
                            {props.time}
                        </View>
                    </View>
                    <View className="xxm-user-rate-ls__desc">
                        {props.content}
                    </View>
                    <View className="xxm-user-rate-ls__content">
                        { props.goods &&<PreviewEle goods={props.goods} />}
                    </View>
                </View>
            </View>
        </View>
    )
}